﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data.Linq;


namespace ProSOLD
{
  /// <summary>
  /// Interaction logic for admin.xaml
  /// </summary>
  public partial class admin : Page
  {


    #region DbTanımlama
    const string ConnState = @"Data Source=.\SQLEXPRESS; AttachDbFilename=""|DataDirectory|\Database1.mdf""; Integrated Security = True; User Instance = True";
    #endregion


    DataContext db = new DataContext(ConnState);

    public admin()
    {
      InitializeComponent();
      /*
    
      <Page.Background>
        <ImageBrush Stretch="Fill"  ImageSource="/ProSOLD;component/images/sagtaraf.jpg"/>
        
    </Page.Background>
    */


    }

  


    private void mediaElement1_MouseDown(object sender, MouseButtonEventArgs e)
    {
     
    }

    private void mediaElement1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
 
    }

    private void button1_Click_1(object sender, RoutedEventArgs e)
    {
        Table<AdminTable> tablom = db.GetTable<AdminTable>();

      foreach (var yok in from c in tablom select c)
      {

        try
        {

          if (textBox1.Text == yok.adminName && textBox2.Text == yok.adminnPass)
          {
            admin_hq cl = new admin_hq();

            NavigationService nav;

            nav = NavigationService.GetNavigationService(this);


            nav.Navigate(new System.Uri("admin_hq.xml", UriKind.RelativeOrAbsolute));


            nav.Navigate(cl);

          }
        }

        catch
        {
          listBox1.Items.Add(yok.info);


        }
        }

    }


  }
}
